﻿using eGrid_App;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows;
using System.Windows.Controls;

namespace GISforTT_Test
{
    
    
    /// <summary>
    ///This is a test class for BookmarkPinTest and is intended
    ///to contain all BookmarkPinTest Unit Tests
    ///</summary>
    [TestClass()]
    public class BookmarkPinTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for BookmarkPin Constructor
        ///</summary>
        [TestMethod()]
        public void BookmarkPinWithPointConstructorTest()
        {
            //Constructor with screen point
            Point screenPoint = new Point(200, 200);
            BookmarkPin target = new BookmarkPin(screenPoint);
            Assert.AreEqual(screenPoint, target.ScreenPt);
        }

        /// <summary>
        ///A test for BookmarkPin Constructor
        ///</summary>
        [TestMethod()]
        public void BookmarkPinWithBookmarkPinConstructorTest()
        {
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            Point screenPoint = new Point(200, 200);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            Assert.AreEqual(bm, target.Bookmark);
            Assert.AreEqual(screenPoint, target.ScreenPt);
        }

        /// <summary>
        ///A test for GetDescriptionBlock
        ///</summary>
        [TestMethod()]
        public void GetDescriptionBlockTest()
        {
            Point screenPoint = new Point(200, 200);
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            TextBlock actual;
            actual = target.GetDescriptionBlock();
            Assert.AreEqual("Test Description", actual.Text);
        }

        /// <summary>
        ///A test for Tap
        ///</summary>
        [TestMethod()]
        public void TapTest()
        {
            Point screenPoint = new Point(200, 200);
            BookmarkPin target = new BookmarkPin(screenPoint);
            //newly created pin should have not been tapped
            Assert.AreEqual(false, target.isActive);
            target.Tap();
            //after its tapped, it should be active now
            Assert.AreEqual(true, target.isActive);
            target.Tap();
            //now it should be false again
            Assert.AreEqual(false, target.isActive);
        }

        /// <summary>
        ///A test for Bookmark
        ///</summary>
        [TestMethod()]
        public void BookmarkTest()
        {
            Point screenPoint = new Point(200, 200);
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            Bookmark actual;
            actual = target.Bookmark;
            Assert.AreEqual(bm, actual);
        }

        /// <summary>
        ///A test for Description
        ///</summary>
        [TestMethod()]
        public void DescriptionTest()
        {
            Point screenPoint = new Point(200, 200);
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            string actual;
            actual = target.Description;
            Assert.AreEqual("Test Description", actual);
        }

        /// <summary>
        ///A test for DescriptionBlock
        ///</summary>
        [TestMethod()]
        public void DescriptionBlockTest()
        {
            Point screenPoint = new Point(200, 200);
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            TextBlock expected = new TextBlock();
            expected.Text = "This is a description";
            TextBlock actual;
            target.DescriptionBlock = expected;
            actual = target.DescriptionBlock;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Priority
        ///</summary>
        [TestMethod()]
        public void PriorityTest()
        {
            Point screenPoint = new Point(200, 200);
            Bookmark bm = new Bookmark(new ESRI.ArcGIS.Client.Geometry.Envelope(), "Test Description", "123", Bookmark.BookmarkPriority.High);
            BookmarkPin target = new BookmarkPin(bm, screenPoint);
            Bookmark.BookmarkPriority expected = Bookmark.BookmarkPriority.High;
            Bookmark.BookmarkPriority actual;
            target.Priority = expected;
            actual = target.Priority;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for ScreenPt
        ///</summary>
        [TestMethod()]
        public void ScreenPtTest()
        {
            Point screenPoint = new Point(200, 200);
            BookmarkPin target = new BookmarkPin(screenPoint);
            Point expected = new Point(300, 300);
            Point actual;
            target.ScreenPt = expected;
            actual = target.ScreenPt;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for X
        ///</summary>
        [TestMethod()]
        public void XTest()
        {
            Point screenPoint = new Point(200, 100);
            BookmarkPin target = new BookmarkPin(screenPoint);
            int actual;
            actual = target.X;
            Assert.AreEqual(200, actual);
        }

        /// <summary>
        ///A test for Y
        ///</summary>
        [TestMethod()]
        public void YTest()
        {
            Point screenPoint = new Point(200, 100);
            BookmarkPin target = new BookmarkPin(screenPoint);
            int actual;
            actual = target.Y;
            Assert.AreEqual(100, actual);
        }
    }
}
